<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class LabourerWage extends Model
{
    use HasFactory;
    protected $fillable = ['labourer_id','project_id','period','pay','deductions','price','status','method','payment_date','remarks','files','issue_date'];

    const POSTONLY = ['labourer_id','project_id','period','pay','deductions','price','status','method','payment_date','remarks','files','issue_date'];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function labourer()
    {
        return $this->hasOne(Labourer::class,'id','labourer_id');
    }
}
